package aiku.numericalcontroloa.Model.Entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;

@Data
public abstract class BaseEntity {

    // 主键自动注入(ASSIGN_UUID 为不含-的UUID)
    @TableId(type = IdType.ASSIGN_UUID)
    private String id;

    @TableField(value = "create_time",fill = FieldFill.INSERT)
    private Date createTime;


    @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
    private Date  updateTime;

    @TableField(value = "deleted")
    @TableLogic // 标注该字段为逻辑删除
    private Integer deleted;

    /**
     * 获取创建时间戳
     * @return 创建时间戳
     */
    public Long getCreateTimeStamp(){
        return createTime.getTime();
    }

    /**
     * 获取更新时间戳
     * @return 更新时间戳
     */
    public Long getUpdateTimeStamp() {
        return createTime.getTime();
    }

}